#ifndef PAGE_WEATHER_H
#define PAGE_WEATHER_H

#include <Arduino.h>
#include <vector>
#include "page_base.h"
#include "../helper/helper.h"
#include "../api/api.h"

namespace Page
{

    class Weather : public Base
    {
    protected:
        int layoutScreenWidth = 800;
        int layoutScreenHeight = 480;
        int layoutBoardMargin = 15;
        int layputBoardRound = 10;
        int setDaysCount = 7;
        int setHoursCount = 12;

        // Board Today
        int layoutBoardTodayWidth = 205;
        int layoutBoardTodayHeight = layoutScreenHeight;
        int layoutBoardTodayX = 0;
        int layoutBoardTodayY = 0;
        int layoutBoardTodayCenterX = layoutBoardTodayWidth / 2;

        int layoutBoardRightWith = layoutScreenWidth - layoutBoardTodayWidth - layoutBoardMargin;

        // Board Hours
        int layoutBoardHourWidth = layoutBoardRightWith;
        int layoutBoardHourHeight = 214;
        int layoutBoardHourX = layoutBoardTodayWidth + layoutBoardMargin;
        int layoutBoardHourY = 0;
        // Board Hours.temp area(text && bar)
        int layoutBoardHourTempBarDescent = layoutBoardHourHeight - 82;
        int layoutBoardHourTempBarWidth = 8;
        int layoutBoardHourTempBarHeightMax = layoutBoardHourHeight - 122;
        int layoutBoardHourTempBarHeightMin = 14;

        // Board Days
        int layoutBoardDayWidth = layoutBoardRightWith;
        int layoutBoardDayHeight = layoutScreenHeight - layoutBoardHourHeight - layoutBoardMargin;
        int layoutBoardDayX = layoutBoardTodayWidth + layoutBoardMargin;
        int layoutBoardDayY = layoutBoardHourHeight + layoutBoardMargin;
        // set layout X for items
        int innerBDayTempBarWidth = 300;
        int innerBDayStrDayCX = layoutBoardDayX + 50;
        int innerBDayIconCX = innerBDayStrDayCX + 50;
        int innerBDayTempTextWidth = 50;
        int innerBDayTempWidth = innerBDayTempBarWidth + innerBDayTempTextWidth * 2;
        int innerBDayTempBarBeginX = innerBDayIconCX + 12 + 10 + innerBDayTempTextWidth;
        // calc layout Y for ROWS
        int innerDayRowBeginY = layoutBoardDayY + layoutBoardMargin - /*adjust*/ 3;
        int innerDayRowStepY = (layoutBoardDayHeight - layoutBoardMargin * 2 + /*adjust*/ 4) / 7;
        int innerDayRowStepCenterY = innerDayRowStepY / 2;
        // Board Hours.temp area(text && bar)
        int innerBDayTempBarWide = 6;

        void _drawBoardToday(Api::Data data);
        void _drawBoardHours(Api::Data data);
        void _drawBoardDays(Api::Data data);

    public:
        Weather();
        void show(Api::Data data);
    };

}

#endif